/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: transparent;
}

/* 透明遮罩层 - 空白区域点击穿透 */
.overlay-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 默认穿透 */
    z-index: 9999;
    background: transparent; /* 透明背景 */
}

/* 控制按钮区域 */
.control-panel {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: auto; /* 按钮区域不穿透 */
    z-index: 10001;
}

.control-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    pointer-events: auto;
    white-space: nowrap;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.control-btn:active {
    transform: translateY(0);
}

/* 面板样式 - 空白区域点击穿透，面板内容可以交互 */
.modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;  /* 默认穿透 */
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
}

.modal-panel.show {
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;  /* 面板显示时可以交互 */
}

.panel-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    min-width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    pointer-events: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.panel-header h2 {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.panel-body {
    padding: 25px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    color: #fff;
}

/* 人物信息面板样式 */
.character-info {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 25px;
}

.character-info + .attributes-grid {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 25px;
}

.avatar-section {
    text-align: center;
}

.avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.character-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.character-level {
    font-size: 16px;
    color: #ffd700;
    font-weight: bold;
}

.stats-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.stat-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.stat-bar.magic .stat-fill {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
}

.stat-bar.exp .stat-fill {
    background: linear-gradient(90deg, #fad961 0%, #f76b1c 100%);
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(67, 233, 123, 0.5);
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
    align-self: flex-end;
}

.attributes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.attribute-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.attribute-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.attr-icon {
    font-size: 24px;
}

.attr-label {
    flex: 1;
    font-size: 14px;
}

.attr-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

/* 背包面板样式 */
.backpack-content {
    min-width: 600px;
}

.backpack-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.item-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.item-slot:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* 排行榜面板样式 */
.rank-content {
    min-width: 500px;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rank-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.rank-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.rank-item.gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 140, 0, 0.2) 100%);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.rank-item.silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(169, 169, 169, 0.2) 100%);
    border: 2px solid rgba(192, 192, 192, 0.5);
}

.rank-item.bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(184, 115, 51, 0.2) 100%);
    border: 2px solid rgba(205, 127, 50, 0.5);
}

.rank-number {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    min-width: 30px;
}

.rank-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.rank-level {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.rank-score {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

/* 卡片特效面板样式 */
.card-effect-panel.show {
    animation: cardEnter 0.5s ease-out;
}

@keyframes cardEnter {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.card-content {
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
}

.card-effect-container {
    position: relative;
    display: inline-block;
}

.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(255,215,0,0.6) 0%, transparent 70%);
    border-radius: 20px;
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.card-item {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    min-width: 350px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
    z-index: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.card-image {
    font-size: 80px;
    margin: 20px 0;
    animation: cardFloat 3s ease-in-out infinite;
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.card-name {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #fff;
}

.card-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    line-height: 1.6;
}

.card-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.card-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.card-stat span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.card-stat strong {
    font-size: 20px;
    color: #ffd700;
}

/* 滚动条样式 */
.panel-body::-webkit-scrollbar {
    width: 8px;
}

.panel-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 响应式设计 */

/* 手机横屏适配 (竖屏手机 or 平板竖屏) */
@media (max-width: 768px) {
    .control-panel {
        top: 5px;
        gap: 8px;
        flex-wrap: wrap;
        max-width: 95vw;
        justify-content: center;
    }
    
    .control-btn {
        flex: 0 1 auto;
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .panel-content {
        min-width: 90vw;
        max-height: 85vh;
    }
    
    .panel-header {
        padding: 15px 20px;
    }
    
    .panel-header h2 {
        font-size: 18px;
    }
    
    .close-btn {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }
    
    .panel-body {
        padding: 20px;
    }
    
    .backpack-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .attributes-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .card-item {
        min-width: 280px;
        padding: 20px;
    }
    
    .avatar {
        width: 100px;
        height: 100px;
        font-size: 36px;
    }
    
    .character-name {
        font-size: 20px;
    }
}

/* 手机横屏专用适配 (高度受限) */
@media (max-height: 600px) and (orientation: landscape) {
    /* 控制按钮区域优化 */
    .control-panel {
        top: 5px;
        gap: 8px;
        flex-wrap: wrap;
        max-width: 95vw;
    }
    
    .control-btn {
        padding: 6px 14px;
        font-size: 12px;
        border-radius: 18px;
    }
    
    /* 面板内容优化 */
    .panel-content {
        max-height: 88vh;
        min-width: auto;
        width: auto;
    }
    
    .panel-header {
        padding: 12px 18px;
    }
    
    .panel-header h2 {
        font-size: 16px;
    }
    
    .panel-body {
        padding: 15px;
        max-height: calc(88vh - 60px);
    }
    
    /* 人物信息面板横屏布局优化 */
    .character-info {
        flex-direction: row;
        gap: 20px;
        margin-bottom: 15px;
    }
    
    .character-info + .attributes-grid {
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .avatar-section {
        flex: 0 0 auto;
        margin-bottom: 0;
        padding-right: 20px;
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        text-align: left;
    }
    
    .stats-section {
        flex: 1;
        min-width: 0;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
        font-size: 32px;
        margin-bottom: 8px;
    }
    
    .character-name {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .character-level {
        font-size: 14px;
    }
    
    .stats-section {
        gap: 10px;
    }
    
    .stat-item {
        gap: 5px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-bar {
        height: 6px;
    }
    
    .stat-value {
        font-size: 12px;
    }
    
    .attributes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .attribute-item {
        padding: 12px;
    }
    
    .attr-icon {
        font-size: 20px;
    }
    
    .attr-label {
        font-size: 12px;
    }
    
    .attr-value {
        font-size: 16px;
    }
    
    /* 背包面板横屏优化 */
    .backpack-content {
        max-width: 90vw;
    }
    
    .backpack-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }
    
    .item-slot {
        font-size: 12px;
    }
    
    /* 排行榜面板横屏优化 */
    .rank-content {
        max-width: 85vw;
    }
    
    .rank-list {
        gap: 8px;
    }
    
    .rank-item {
        padding: 10px 15px;
        gap: 12px;
    }
    
    .rank-number {
        font-size: 18px;
        min-width: 25px;
    }
    
    .rank-avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .rank-name {
        font-size: 14px;
        margin-bottom: 3px;
    }
    
    .rank-level {
        font-size: 12px;
    }
    
    .rank-score {
        font-size: 16px;
    }
    
    /* 卡片特效面板横屏优化 */
    .card-item {
        min-width: auto;
        padding: 20px;
        max-width: 85vw;
    }
    
    .card-title {
        font-size: 20px;
    }
    
    .card-image {
        font-size: 60px;
        margin: 15px 0;
    }
    
    .card-name {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .card-description {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .card-stats {
        padding-top: 15px;
        gap: 15px;
    }
    
    .card-stat span {
        font-size: 12px;
    }
    
    .card-stat strong {
        font-size: 18px;
    }
    
    /* 关闭按钮横屏优化 */
    .close-btn {
        width: 26px;
        height: 26px;
        font-size: 18px;
    }
}

/* 超小屏手机横屏 (高度小于500px) */
@media (max-height: 500px) and (orientation: landscape) {
    .control-panel {
        top: 3px;
        gap: 6px;
    }
    
    .control-btn {
        padding: 5px 12px;
        font-size: 11px;
        border-radius: 15px;
    }
    
    .panel-content {
        max-height: 92vh;
    }
    
    .panel-header {
        padding: 10px 15px;
    }
    
    .panel-header h2 {
        font-size: 14px;
    }
    
    .panel-body {
        padding: 12px;
        max-height: calc(92vh - 50px);
    }
    
    /* 紧凑布局 */
    .character-info {
        flex-direction: row;
        gap: 15px;
        margin-bottom: 12px;
    }
    
    .character-info + .attributes-grid {
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .avatar-section {
        flex: 0 0 auto;
        padding-right: 15px;
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        text-align: left;
    }
    
    .avatar {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
    
    .character-name {
        font-size: 16px;
    }
    
    .stats-section {
        flex: 1;
        min-width: 0;
        gap: 8px;
    }
    
    .backpack-grid {
        gap: 6px;
    }
    
    .rank-item {
        padding: 8px 12px;
    }
    
    .rank-avatar {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* 平板横屏适配 */
@media (min-width: 769px) and (max-height: 800px) and (orientation: landscape) {
    .panel-content {
        max-height: 85vh;
    }
    
    .backpack-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .card-item {
        min-width: 400px;
    }
}

/* 暗色蒙版层 - 打开面板时显示 */
.overlay-dark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay-dark.show {
    opacity: 1;
}
